// package cn.geminis.cloud.gateway.service;

// import lombok.extern.slf4j.Slf4j;
// import org.springframework.security.authorization.AuthorizationDecision;
// import org.springframework.security.authorization.ReactiveAuthorizationManager;
// import org.springframework.security.core.Authentication;
// import org.springframework.security.web.server.authorization.AuthorizationContext;
// import org.springframework.stereotype.Service;
// import org.springframework.web.server.ServerWebExchange;
// import reactor.core.publisher.Mono;

// /**
//  * @author puddi
//  */
// @Slf4j
// @Service
// public class PermissionAuthorizationManager implements ReactiveAuthorizationManager<AuthorizationContext> {

//     @Override
//     public Mono<AuthorizationDecision> check(Mono<Authentication> authenticationMono, AuthorizationContext authorizationContext) {
//         var exchange = authorizationContext.getExchange();
//         //请求资源
//         String requestPath = exchange.getRequest().getURI().getPath();
//         return authenticationMono.map(auth -> new AuthorizationDecision(checkAuthorities(exchange, auth, requestPath)))
//                 .defaultIfEmpty(new AuthorizationDecision(false));
//     }

//     private boolean checkAuthorities(ServerWebExchange exchange, Authentication auth, String requestPath) {
//         var checkResult = true;
//         log.debug("访问权限检查，用户:{}，URL：{}，结果：{}", auth.getName(), requestPath, checkResult);
//         return checkResult;
//     }
// }
